<?php $this->load->view('common/head');?>
<?php $this->load->view('common/navbar');?>
<div class="panel panel-default">
  <!-- Default panel contents -->
  <div class="panel-heading">百县强基项目修改</div>
  <div class="panel-body">
	  <div class="col-md-10 col-md-offset-1">
		<form class="form-inline" name="add" id="add" action="<?php echo $this->input->server('REQUEST_URI'); ?>" method="post">
		  <input type="hidden" name="id" id="id" value="<?=$projectData['id']?>">
		  <input type="hidden" name="procId" id="procId" value="<?=$projectData['procId']?>">
	  	  <!-- Table -->
		  <table class="table table-condensed">
		    <tbody>
		      <tr>
		        <td class="bg-primary col-md-3"><label for="projectName" class="control-label">项目名称：</label></td>
		        <td><input type="input" class="form-control" name="projectName" id="projectName" value="<?=$projectData['projectName']?>" placeholder="项目名称"></td>
		      </tr>
		      <tr>
		        <td class="bg-primary"><label for="actionType" class="control-label">标准动作：</label></td>
		        <td>
		        	<select class="form-control" placeholder=".col-xs-4" id="actionType" name="actionType">
		        		<option value="">请选择</option>
			            <?php foreach ($actionList as $k => $v) {?>
			            <option value="<?=$k?>" <?=$k==$projectData['actionType']?'selected="selected"':''?>><?=$v?></option>
			            <?php } ?>
			          </select>
			          <input type="input" class="form-control" name="actionAlias" id="actionAlias" value="<?=$projectData['actionAlias']?>" placeholder="其他标准动作">
		        </td>
		      </tr>
		      <tr>
		        <td class="bg-primary col-md-3"><label for="eventType" class="control-label">活动类型：</label></td>
		        <td>
		        	<select class="form-control" placeholder=".col-xs-4" id="eventType" name="eventType">
			            <option value="">请选择活动类型</option>
			          </select>
		        </td>
		      </tr>
		      <tr>
		        <td class="bg-primary col-md-3"><label for="eventClass" class="control-label">活动分类：</label></td>
		        <td>
			    	<select class="form-control" placeholder=".col-xs-4" id="eventClass" name="eventClass">
			          <option value="">请选择活动分类</option>
			        </select>
			        <input type="input" class="form-control" name="eventClassAlias" id="eventClassAlias" value="<?=$projectData['eventClassAlias']?>" placeholder="活动分类其他值">
		        </td>
		      </tr>
		      <tr>
		      	<td></td>
		      	<td>
		      		<button type="submit" class="btn btn-default btn-primary">下一步</button>
		      		<button type="button" onclick="history.go(-1)" class="btn btn-default btn-primary">取消</button>
		      	</td>
		      </tr>
		    </tbody>
		  </table>
		</form>
		</div>
	</div>
</div>
<script type="text/javascript" src="public/js/commonProject.js"></script>
<script type="text/javascript">
$(function(){
	initValidation();
	loadEventType(<?=$projectData['eventType']?>);
	loadEventClass(<?=$projectData['eventType']?>,<?=$projectData['eventClass']?>);
	eventClassAliasDisplay(<?=$projectData['eventClass']?>);
	actionAliasDisplay();
	$("#actionType").change(function(){
		actionAliasDisplay();
		initValidation();
	});
	$('#eventType').change(function(){
		loadEventClass(this.value);
		initValidation();
	});
	$("#eventClass").change(function(){
		eventClassAliasDisplay(this.value);
		initValidation();
	});
});
//初始化验证
function initValidation(){
	$('form[name="add"]').find("input,select,textarea").jqBootstrapValidation("destroy");
	$('form[name="add"]').find("input,select,textarea").not("[type=submit]").jqBootstrapValidation({
	    preventSubmit:false,
	    submitSuccess: function (form, event) {
	         event.preventDefault();
	         ajaxFormSubmit('add');
	     },
	     submitError: function (form, event, errors) {
	       event.preventDefault();
	       }
  	});
}
</script>
<?php $this->load->view('common/foot');?>